﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace AgileDashboard.Data
{
    public class FieldDataSource
    {

        public static bool DoesFieldExist(string name, FieldCollection fields)
        {
            if (fields.Contains(name))
                return true;
            else
                return false;
        }
            
      public static double? GetDoubleFieldValue(string name, FieldCollection fields)
      {
          if (DoesFieldExist(name, fields))
          {
              if (fields[name].Value == null)
                  return 0;

              return (double)fields[name].Value;
          }

          return 0;
      }
    }
}
